# verification : https://atcoder.jp/contests/practice2/submissions/26356484

import sys
input = sys.stdin.readline

# consider to remove assert for better performance
class fenwick_tree:
    def __init__(self, _n):
        self.n = _n
        self.tree = [0] * (_n + 1)

    # index is in [0, n)
    def update(self, index, d):
        assert 0 <= index < self.n
        index += 1
        
        while index <= self.n:
            self.tree[index] += d
            index += index & -index

    # returns the sum of the range[0, p)
    def query(self, p):
        assert p <= self.n
        ret = 0

        while p > 0:
            ret += self.tree[p]
            p -= p & -p

        return ret

    # returns the sum of the range[first, last)
    def query_range(self, first, last):
        return self.query(last) - self.query(first)

N, Q = map(int, input().split())
tree = fenwick_tree(N)

for i, value in enumerate(list(map(int, input().split()))):
    tree.update(i, value)

while Q > 0:
    Q -= 1

    t, a, b = map(int, input().split())

    if t == 0:
        tree.update(a, b)
    else:
        print(tree.query_range(a, b))

